/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.ban.nmpp.se.server;

import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class test {

    public static void main(String[] args) {
        Cluster.Builder builder = Cluster.builder().addContactPoint("192.168.11.95").withCredentials("cassandra", "cassandra");
            Cluster cluster = builder.build();
            System.out.println("haha");
            Session session = cluster.connect();
            System.out.println("haha");
        try {
            String queryCql = "select * from test.tp_msg_news";
            ResultSet rs = session.execute(queryCql);
            System.out.println("haha");
            List<Row> datalist = rs.all();
            for (Row row : datalist) {
                System.out.println("==>" + row.getString("key"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            session.close();
            cluster.close();
        }

    }
}
